package entidade;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author desenvolvimento
 */
public class JpaUtil {

    private static final long serialVersionUID = 1L;
    private static JpaUtil instancia;
    private EntityManagerFactory factory;

    private JpaUtil() {
        factory = Persistence.createEntityManagerFactory("SexShoppingPU");
    }

    public static JpaUtil getInstancia() {

        if (instancia == null) {
            instancia = new JpaUtil();
        }
        return instancia;
    }

    public EntityManager getEntidadeManager() {
        return factory.createEntityManager();
    }
}